package com.gxa.admin.oss.factory;

import com.gxa.admin.oss.config.StorageConfig;
import com.gxa.admin.oss.service.AbstractStorageService;
import com.gxa.admin.oss.service.impl.TencentStorageService;
import com.gxa.admin.oss.utils.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;


/**
 * <h3>travel</h3>
 * <p></p>
 *
 * @author : ch
 * @date : 2024-03-11 21:12
 **/
@Component
public class OssFactory {

    private static StorageConfig config;

    @Autowired
    private StorageConfig storageConfig;


    @PostConstruct
    public void init(){
        config = storageConfig;

    }
    //根据配置文件中的类型  创建对应的存储服务
    public static AbstractStorageService build(){
        if(config.getType()== Constant.StorageService.TENCENT.getId()){
            return new  TencentStorageService(config);
            
        }else {
            return null;
        }
    }



}
